//复杂度为n^2的解法
var findKthLargest = function (nums, k) {
    for(i=1;i<nums.length;i++){
        for(j=0;j<nums.length;j++){
            if(nums[i]>nums[j]){
                let temp =nums[j]
                nums[j]=nums[i]
                nums[i]=temp
            }
        }
    }
    return nums[k-1];
};

console.log(findKthLargest([3, 2, 1, 5, 6, 4], 2));

